using System.Collections.ObjectModel;
using HMCollada.Core;
using System.Xml;

namespace HMCollada.Core {
    internal struct HMColladaLibraryVisualScenes {
        internal string id;
        internal string name;
        internal HMColladaAsset asset;
        internal Collection<HMColladaVisualScene> visual_scene;
    }
}

namespace HMCollada {
    internal partial class HMColladaLoader {
        internal static HMColladaLibraryVisualScenes LoadLibraryVisualScenes() {
            HMColladaLibraryVisualScenes newLibraryVisualScenes = new HMColladaLibraryVisualScenes();
            newLibraryVisualScenes.id = colladaReader.GetAttribute("id");
            newLibraryVisualScenes.name = colladaReader.GetAttribute("name");

            newLibraryVisualScenes.visual_scene = new Collection<HMColladaVisualScene>();

            if (!colladaReader.IsEmptyElement) colladaReader.Read();
            do {
                if (colladaReader.NodeType != XmlNodeType.EndElement) {
                    switch (colladaReader.Name) {
                        case "asset": newLibraryVisualScenes.asset = LoadAsset(); break;
                        case "visual_scene": newLibraryVisualScenes.visual_scene.Add(LoadVisualScene()); break;
                    }
                }

                if (!colladaReader.IsEmptyElement) colladaReader.Read();
            } while (colladaReader.Name != "library_visual_scenes");

            if (colladaReader.IsEmptyElement) colladaReader.Read();
            return newLibraryVisualScenes;
        }
    }
}